package d0324;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class TestReg {

    public static void main(String[] args) {
        String regex="^((13[0-9])|(15[^4])|(18[0,2,3,5-9])|(17[0-8])|(147))\\d{8}$";
        Pattern pattern=Pattern.compile(regex);
        String phoneNum="13958965698";
        Matcher matcher=pattern.matcher(phoneNum);
        if(matcher.matches()){
            System.out.println("true");
        }else{
            System.out.println("false");
        }

        System.out.println("=======================================");

        String regex1="^((13[0-9])|(15[^4])|(18[0,2,3,5-9])|(17[0-8])|(147))\\d{8}$";
        String phoneNum1="13958965698";
        boolean result1=Pattern.matches(regex1,phoneNum1);
        if (result1){
            System.out.println("true");
        }else {
            System.out.println("false");
        }

        System.out.println("=======================================");

        String regex2 = "^((13[0-9])|(15[^4])|(18[0,2,3,5-9])|(17[0-8])|(147))\\d{8}$";
        String phoneNum2="13912345678";
        boolean result2=phoneNum2.matches(regex2);
        if (result2){
            System.out.println("true");
        }else {
            System.out.println("false");
        }
    }
}
